#!/usr/bin/python3``
# -*- coding: utf-8 -*-``
# @Author : SZ2316108 欧阳亨杰``

import os.path
import time
import unittest
from HTMLTestRunner import HTMLTestRunner

if __name__ == "__main__":
    test_pyfiles = ['register_interface.py', 'login_interface.py']
    html_name = ['注册API测试', '登录API测试']
    for py_file, name in zip(test_pyfiles, html_name):
        suite = unittest.TestLoader().discover('', py_file)
        base_dir = os.path.dirname(os.path.realpath(__file__))
        print(base_dir)
        dir_path = base_dir + "\\..\\result\\"
        report_path = dir_path + name + "_result.html"
        with open(report_path, 'wb') as f:
            runner = HTMLTestRunner(stream=f, verbosity=2, title=name, description="html测试")
            runner.run(suite)
